import java.util.*;
class NeighbouringNumbers {
    
	public static void main (String args[]) {
		int[] inputArray = readInputArray();
        System.out.println("Target index is: " + findNeighbouringNumbers(inputArray));
	}
    
    private static int[] readInputArray() {
        int arraySize;
        Scanner in = new Scanner(System.in);
        do {
            System.out.print("Enter a size of array: ");
            while (!in.hasNextInt()) {                      // check if entered number is integer
                System.out.println("Invalid size of array");
                in.next();
            }
            arraySize = in.nextInt();
        } while (arraySize < 0 );                           // check if entered number is positive
           
        int[] result = new int[arraySize];
		for (int i = 0; i < result.length; i++) {
            System.out.print("inputArray[" + i + "]=");
            while (!in.hasNextInt()) {                      // check if ith aray element is integer
                System.out.print("Array elements should be integer" + "\ninputArray[" + i + "]=");
                in.next();
            }    
            result[i] = in.nextInt();
		}
        in.close();
        return result;
    }
    
    private static int findNeighbouringNumbers(int[] inputArray) {
        int globalDifference = Integer.MAX_VALUE;
		int currentDifference = 0;
		int result = 0;
		for (int i = 0; i < inputArray.length - 1; i++) {   // go through all elements of array and find the minimal difference
			currentDifference = Math.abs(inputArray[i+1] - inputArray[i]);
			if (currentDifference < globalDifference){
				globalDifference = currentDifference;
				result = i;
			}
		}
        return result;
    }
}